<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/26
 * Time: 15:28
 */

namespace app\modules\api\controllers\open;

use app\modules\api\controllers\Controller;
use app\opening\BaseApiResponse;
use app\modules\api\models\OrderListForm;
use app\modules\api\models\OrderDetailForm;
use app\modules\api\models\IndexForm;

class OrderController extends BaseController
{

    /**
     * 订单列表
     * @return \app\opening\ApiResponse
     * author eRic
     * dateTime 2019-08-04 9:49
     *
     */
    public function actionList()
    {
        $form             = new OrderListForm();
        $form->attributes = \Yii::$app->request->get();
        $form->status     = \Yii::$app->request->get('status');
        $form->date_start = \Yii::$app->request->get('date_start');
        $form->date_end   = \Yii::$app->request->get('date_end');
        $form->store_id   = $this->store->id;
        //$form->user_id = \Yii::$app->user->id;
        return new BaseApiResponse($form->searchOpen());
    }

    /**
     * 订单详情
     * author eRic
     * dateTime 2019-08-04 9:50
     */
    public function actionDetail()
    {
        $form             = new OrderDetailForm();
        $form->attributes = \Yii::$app->request->get();
        $form->order_no   = \Yii::$app->request->get('order_no');
        $form->store_id   = $this->store->id;
        $form->user_id    = \Yii::$app->user->id;
        return new BaseApiResponse($form->searchOpen());
    }
}
